Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernization and Migration of InputWithExamples to NumericInput folder #2121

Merged

Conversation

SonicScrewdriver
Copy link
Contributor

@SonicScrewdriver SonicScrewdriver commented Jan 16, 2025

Summary:

This PR is part of the Numeric Input Project work. It is being landed onto the feature/numeric-dx-refactor branch.

This PR contains the following changes:

  1. Moves the InputWithExamples component to the NumericInput folder
  2. Modernizes InputWithExamples to be a functional component
  3. Addition of some comments

Video Example of Snapshot Testing:

Screen.Recording.2025-01-16.at.2.45.52.PM.mov

Issue: LEMS-2785

Test plan:

  • Ensure all tests pass
  • Manual testing with PR Snapshot in upstream consumer
  • Landing onto feature branch that will see full QA regression pass before deployment

@SonicScrewdriver SonicScrewdriver self-assigned this Jan 16, 2025
@SonicScrewdriver SonicScrewdriver changed the title docs(changeset): Modernization and Migration of InputWithExamples to NumericInput folder Modernization and Migration of InputWithExamples to NumericInput folder Jan 16, 2025
Copy link
Contributor

github-actions bot commented Jan 16, 2025

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (054c29c) and published it to npm. You
can install it using the tag PR2121.

Example:

yarn add @khanacademy/perseus@PR2121

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR2121

Copy link
Contributor

github-actions bot commented Jan 16, 2025

Size Change: +74 B (+0.01%)

Total Size: 1.47 MB

Filename Size Change
packages/perseus/dist/es/index.js 396 kB +74 B (+0.02%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 86.8 kB
packages/math-input/dist/es/index.js 77.7 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 27.1 kB
packages/perseus-editor/dist/es/index.js 689 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus-score/dist/es/index.js 113 kB
packages/perseus/dist/es/strings.js 5.1 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

const [state, setState] = React.useState<State>({
focused: false,
showExamples: false,
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two variables are always set together, so I've opted to keep this pairing after the shift to the functional component. I wasn't sure of a good name to explain both of them so I went "generic", but I could easily see an argument to rename this to something like "setFocusStates".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...Wait. If these are always set the exact same thing in multiple places ... why do we even need both? I bet we could just use "focused".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated this to just use a single inputFocused state.

@SonicScrewdriver SonicScrewdriver marked this pull request as ready for review January 16, 2025 23:12
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted to keep this a separate file as it seemed like too long a component to append to the numeric-input file.

focus: () => {
if (inputRef.current) {
inputRef.current.focus();
inputRef.current?.focus();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the optional (?) needed when we have the code within a conditional that checks for its existence? I thought that Typescript was able to understand that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooo I actually meant to replace the if conditional! Thank you for catching this

Copy link
Contributor

@mark-fitzgerald mark-fitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Great progress on all this clean-up work.

@SonicScrewdriver SonicScrewdriver force-pushed the input-examples-to-numeric branch from 64d86ca to 054c29c Compare January 28, 2025 20:07
@SonicScrewdriver SonicScrewdriver merged commit e603970 into feature/numeric-dx-refactor Jan 28, 2025
8 checks passed
@SonicScrewdriver SonicScrewdriver deleted the input-examples-to-numeric branch January 28, 2025 20:13
SonicScrewdriver added a commit that referenced this pull request Jan 30, 2025
…er (#2121)

## Summary:
This PR is part of the Numeric Input Project work. It is being landed onto the `feature/numeric-dx-refactor` branch. 

This PR contains the following changes:
1. Moves the InputWithExamples component to the NumericInput folder
2. Modernizes InputWithExamples to be a functional component 
3. Addition of some comments 

Video Example of Snapshot Testing:

https://github.com/user-attachments/assets/ca917778-50b0-46d2-89d8-dad95d1dadf2



Issue: LEMS-2785

## Test plan:
- Ensure all tests pass 
- Manual testing with PR Snapshot in upstream consumer 
- Landing onto feature branch that will see full QA regression pass before deployment

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2121
SonicScrewdriver added a commit that referenced this pull request Feb 3, 2025
…er (#2121)

This PR is part of the Numeric Input Project work. It is being landed onto the `feature/numeric-dx-refactor` branch.

This PR contains the following changes:
1. Moves the InputWithExamples component to the NumericInput folder
2. Modernizes InputWithExamples to be a functional component
3. Addition of some comments

Video Example of Snapshot Testing:

https://github.com/user-attachments/assets/ca917778-50b0-46d2-89d8-dad95d1dadf2

Issue: LEMS-2785

- Ensure all tests pass
- Manual testing with PR Snapshot in upstream consumer
- Landing onto feature branch that will see full QA regression pass before deployment

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2121
SonicScrewdriver added a commit that referenced this pull request Feb 6, 2025
…er (#2121)

This PR is part of the Numeric Input Project work. It is being landed onto the `feature/numeric-dx-refactor` branch.

This PR contains the following changes:
1. Moves the InputWithExamples component to the NumericInput folder
2. Modernizes InputWithExamples to be a functional component
3. Addition of some comments

Video Example of Snapshot Testing:

https://github.com/user-attachments/assets/ca917778-50b0-46d2-89d8-dad95d1dadf2

Issue: LEMS-2785

- Ensure all tests pass
- Manual testing with PR Snapshot in upstream consumer
- Landing onto feature branch that will see full QA regression pass before deployment

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2121
SonicScrewdriver added a commit that referenced this pull request Feb 13, 2025
…er (#2121)

This PR is part of the Numeric Input Project work. It is being landed onto the `feature/numeric-dx-refactor` branch.

This PR contains the following changes:
1. Moves the InputWithExamples component to the NumericInput folder
2. Modernizes InputWithExamples to be a functional component
3. Addition of some comments

Video Example of Snapshot Testing:

https://github.com/user-attachments/assets/ca917778-50b0-46d2-89d8-dad95d1dadf2

Issue: LEMS-2785

- Ensure all tests pass
- Manual testing with PR Snapshot in upstream consumer
- Landing onto feature branch that will see full QA regression pass before deployment

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2121
SonicScrewdriver added a commit that referenced this pull request Feb 24, 2025
…or` to `main` (#2209)

## Summary:
This is the Feature Branch for the Numeric Input Project. 

This PR includes the following commits:
- Move Numeric Input's UI related code to a functional component  (#2108)
- Refactoring Numeric Input helper functions to remove underscore (#2128)
- Modernization and Migration of InputWithExamples to NumericInput folder (#2121)
- [its-a-numeric-story] Improving Numeric Input Storybook Stories (#2138)
- Ensure that Numeric Input Examples only show for correct answers. (#2159)
- [3-quell-the-fracus] [Bug Fix] - Ensure that users hand typing tex into Numeric Inputs on Desktop do not cause an infinite loop. (#2182)
- [fool-tips] Tooltip is Dead. Long Live Tooltip. (#2195)
- [whole-fraction-fix] Ensure that whole numbers are not accepted answers for Numeric Inputs that require Improper fractions. (#2203)
- [scrollin-aint-right] Fix right align scrollbars in Numeric Input  (#2187)
- [message-nit] Minor string adjustment (#2204)

## Test plan:
- tests pass 
- lint passes 
- Passed a Full QA Regression Suite

Author: SonicScrewdriver

Reviewers: nishasy, SonicScrewdriver, handeyeco, mark-fitzgerald

Required Reviewers:

Approved By: nishasy

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x)

Pull Request URL: #2209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants